(function(a){if(typeof define==="function"&&define.amd){define(["jquery"],a)}else{a(jQuery)}}(function(c){var f=0,a=Array.prototype.slice;c.cleanData=(function(g){return function(h){var k,l,j;for(j=0;(l=h[j])!=null;j++){try{k=c._data(l,"events");if(k&&k.remove){c(l).triggerHandler("remove")}}catch(m){}}g(h)}})(c.cleanData);c.widget=function(g,h,o){var l,m,j,n,i={},k=g.split(".")[0];g=g.split(".")[1];l=k+"-"+g;if(!o){o=h;h=c.Widget}c.expr[":"][l.toLowerCase()]=function(p){return !!c.data(p,l)};c[k]=c[k]||{};m=c[k][g];j=c[k][g]=function(p,q){if(!this._createWidget){return new j(p,q)}if(arguments.length){this._createWidget(p,q)}};c.extend(j,m,{version:o.version,_proto:c.extend({},o),_childConstructors:[]});n=new h();n.options=c.widget.extend({},n.options);c.each(o,function(q,p){if(!c.isFunction(p)){i[q]=p;return}i[q]=(function(){var r=function(){return h.prototype[q].apply(this,arguments)},s=function(t){return h.prototype[q].apply(this,t)};return function(){var v=this._super,t=this._superApply,u;this._super=r;this._superApply=s;u=p.apply(this,arguments);this._super=v;this._superApply=t;return u}})()});j.prototype=c.widget.extend(n,{widgetEventPrefix:m?(n.widgetEventPrefix||g):g},i,{constructor:j,namespace:k,widgetName:g,widgetFullName:l});if(m){c.each(m._childConstructors,function(q,r){var p=r.prototype;c.widget(p.namespace+"."+p.widgetName,j,r._proto)});delete m._childConstructors}else{h._childConstructors.push(j)}c.widget.bridge(g,j);return j};c.widget.extend=function(l){var h=a.call(arguments,1),k=0,g=h.length,i,j;for(;k<g;k++){for(i in h[k]){j=h[k][i];if(h[k].hasOwnProperty(i)&&j!==undefined){if(c.isPlainObject(j)){l[i]=c.isPlainObject(l[i])?c.widget.extend({},l[i],j):c.widget.extend({},j)}else{l[i]=j}}}}return l};c.widget.bridge=function(h,g){var i=g.prototype.widgetFullName||h;c.fn[h]=function(l){var j=typeof l==="string",k=a.call(arguments,1),m=this;l=!j&&k.length?c.widget.extend.apply(null,[l].concat(k)):l;if(j){this.each(function(){var o,n=c.data(this,i);if(l==="instance"){m=n;return false}if(!n){return c.error("cannot call methods on "+h+" prior to initialization; attempted to call method '"+l+"'")}if(!c.isFunction(n[l])||l.charAt(0)==="_"){return c.error("no such method '"+l+"' for "+h+" widget instance")}o=n[l].apply(n,k);if(o!==n&&o!==undefined){m=o&&o.jquery?m.pushStack(o.get()):o;return false}})}else{this.each(function(){var n=c.data(this,i);if(n){n.option(l||{});if(n._init){n._init()}}else{c.data(this,i,new g(l,this))}})}return m}};c.Widget=function(){};c.Widget._childConstructors=[];c.Widget.prototype={widgetName:"widget",widgetEventPrefix:"",defaultElement:"<div>",options:{disabled:false,create:null},_createWidget:function(g,h){h=c(h||this.defaultElement||this)[0];this.element=c(h);this.uuid=f++;this.eventNamespace="."+this.widgetName+this.uuid;this.bindings=c();this.hoverable=c();this.focusable=c();if(h!==this){c.data(h,this.widgetFullName,this);this._on(true,this.element,{remove:function(i){if(i.target===h){this.destroy()}}});this.document=c(h.style?h.ownerDocument:h.document||h);this.window=c(this.document[0].defaultView||this.document[0].parentWindow)}this.options=c.widget.extend({},this.options,this._getCreateOptions(),g);this._create();this._trigger("create",null,this._getCreateEventData());this._init()},_getCreateOptions:c.noop,_getCreateEventData:c.noop,_create:c.noop,_init:c.noop,destroy:function(){this._destroy();this.element.unbind(this.eventNamespace).removeData(this.widgetFullName).removeData(c.camelCase(this.widgetFullName));this.widget().unbind(this.eventNamespace).removeAttr("aria-disabled").removeClass(this.widgetFullName+"-disabled ui-state-disabled");this.bindings.unbind(this.eventNamespace);this.hoverable.removeClass("ui-state-hover");this.focusable.removeClass("ui-state-focus")},_destroy:c.noop,widget:function(){return this.element},option:function(k,l){var g=k,m,j,h;if(arguments.length===0){return c.widget.extend({},this.options)}if(typeof k==="string"){g={};m=k.split(".");k=m.shift();if(m.length){j=g[k]=c.widget.extend({},this.options[k]);for(h=0;h<m.length-1;h++){j[m[h]]=j[m[h]]||{};j=j[m[h]]}k=m.pop();if(arguments.length===1){return j[k]===undefined?null:j[k]}j[k]=l}else{if(arguments.length===1){return this.options[k]===undefined?null:this.options[k]}g[k]=l}}this._setOptions(g);return this},_setOptions:function(g){var h;for(h in g){this._setOption(h,g[h])}return this},_setOption:function(g,h){this.options[g]=h;if(g==="disabled"){this.widget().toggleClass(this.widgetFullName+"-disabled",!!h);if(h){this.hoverable.removeClass("ui-state-hover");this.focusable.removeClass("ui-state-focus")}}return this},enable:function(){return this._setOptions({disabled:false})},disable:function(){return this._setOptions({disabled:true})},_on:function(j,i,h){var k,g=this;if(typeof j!=="boolean"){h=i;i=j;j=false}if(!h){h=i;i=this.element;k=this.widget()}else{i=k=c(i);this.bindings=this.bindings.add(i)}c.each(h,function(q,p){function n(){if(!j&&(g.options.disabled===true||c(this).hasClass("ui-state-disabled"))){return}return(typeof p==="string"?g[p]:p).apply(g,arguments)}if(typeof p!=="string"){n.guid=p.guid=p.guid||n.guid||c.guid++}var o=q.match(/^([\w:-]*)\s*(.*)$/),m=o[1]+g.eventNamespace,l=o[2];if(l){k.delegate(l,m,n)}else{i.bind(m,n)}})},_off:function(h,g){g=(g||"").split(" ").join(this.eventNamespace+" ")+this.eventNamespace;h.unbind(g).undelegate(g);this.bindings=c(this.bindings.not(h).get());this.focusable=c(this.focusable.not(h).get());this.hoverable=c(this.hoverable.not(h).get())},_delay:function(j,i){function h(){return(typeof j==="string"?g[j]:j).apply(g,arguments)}var g=this;return setTimeout(h,i||0)},_hoverable:function(g){this.hoverable=this.hoverable.add(g);this._on(g,{mouseenter:function(h){c(h.currentTarget).addClass("ui-state-hover")},mouseleave:function(h){c(h.currentTarget).removeClass("ui-state-hover")}})},_focusable:function(g){this.focusable=this.focusable.add(g);this._on(g,{focusin:function(h){c(h.currentTarget).addClass("ui-state-focus")},focusout:function(h){c(h.currentTarget).removeClass("ui-state-focus")}})},_trigger:function(g,h,i){var l,k,j=this.options[g];i=i||{};h=c.Event(h);h.type=(g===this.widgetEventPrefix?g:this.widgetEventPrefix+g).toLowerCase();h.target=this.element[0];k=h.originalEvent;if(k){for(l in k){if(!(l in h)){h[l]=k[l]}}}this.element.trigger(h,i);return !(c.isFunction(j)&&j.apply(this.element[0],[h].concat(i))===false||h.isDefaultPrevented())}};c.each({show:"fadeIn",hide:"fadeOut"},function(h,g){c.Widget.prototype["_"+h]=function(k,j,m){if(typeof j==="string"){j={effect:j}}var l,i=!j?h:j===true||typeof j==="number"?g:j.effect||g;j=j||{};if(typeof j==="number"){j={duration:j}}l=!c.isEmptyObject(j);j.complete=m;if(j.delay){k.delay(j.delay)}if(l&&c.effects&&c.effects.effect[i]){k[h](j)}else{if(i!==h&&k[i]){k[i](j.duration,j.easing,m)}else{k.queue(function(n){c(this)[h]();if(m){m.call(k[0])}n()})}}}});var b=c.widget;var e=c.widget("ui.menu",{version:"1.11.2",defaultElement:"<ul>",delay:300,options:{icons:{submenu:"ui-icon-carat-1-e"},items:"> *",menus:"ul",position:{my:"left-1 top",at:"right top"},role:"menu",blur:null,focus:null,select:null},_create:function(){this.activeMenu=this.element;this.mouseHandled=false;this.element.uniqueId().addClass("ui-menu ui-widget ui-widget-content").toggleClass("ui-menu-icons",!!this.element.find(".ui-icon").length).attr({role:this.options.role,tabIndex:0});if(this.options.disabled){this.element.addClass("ui-state-disabled").attr("aria-disabled","true")}this._on({"mousedown .ui-menu-item":function(g){g.preventDefault()},"click .ui-menu-item":function(g){var h=c(g.target);if(!this.mouseHandled&&h.not(".ui-state-disabled").length){this.select(g);if(!g.isPropagationStopped()){this.mouseHandled=true}if(h.has(".ui-menu").length){this.expand(g)}else{if(!this.element.is(":focus")&&c(this.document[0].activeElement).closest(".ui-menu").length){this.element.trigger("focus",[true]);if(this.active&&this.active.parents(".ui-menu").length===1){clearTimeout(this.timer)}}}}},"mouseenter .ui-menu-item":function(g){if(this.previousFilter){return}var h=c(g.currentTarget);h.siblings(".ui-state-active").removeClass("ui-state-active");this.focus(g,h)},mouseleave:"collapseAll","mouseleave .ui-menu":"collapseAll",focus:function(i,g){var h=this.active||this.element.find(this.options.items).eq(0);if(!g){this.focus(i,h)}},blur:function(g){this._delay(function(){if(!c.contains(this.element[0],this.document[0].activeElement)){this.collapseAll(g)}})},keydown:"_keydown"});this.refresh();this._on(this.document,{click:function(g){if(this._closeOnDocumentClick(g)){this.collapseAll(g)}this.mouseHandled=false}})},_destroy:function(){this.element.removeAttr("aria-activedescendant").find(".ui-menu").addBack().removeClass("ui-menu ui-widget ui-widget-content ui-menu-icons ui-front").removeAttr("role").removeAttr("tabIndex").removeAttr("aria-labelledby").removeAttr("aria-expanded").removeAttr("aria-hidden").removeAttr("aria-disabled").removeUniqueId().show();this.element.find(".ui-menu-item").removeClass("ui-menu-item").removeAttr("role").removeAttr("aria-disabled").removeUniqueId().removeClass("ui-state-hover").removeAttr("tabIndex").removeAttr("role").removeAttr("aria-haspopup").children().each(function(){var g=c(this);if(g.data("ui-menu-submenu-carat")){g.remove()}});this.element.find(".ui-menu-divider").removeClass("ui-menu-divider ui-widget-content")},_keydown:function(k){var h,j,l,i,g=true;switch(k.keyCode){case c.ui.keyCode.PAGE_UP:this.previousPage(k);break;case c.ui.keyCode.PAGE_DOWN:this.nextPage(k);break;case c.ui.keyCode.HOME:this._move("first","first",k);break;case c.ui.keyCode.END:this._move("last","last",k);break;case c.ui.keyCode.UP:this.previous(k);break;case c.ui.keyCode.DOWN:this.next(k);break;case c.ui.keyCode.LEFT:this.collapse(k);break;case c.ui.keyCode.RIGHT:if(this.active&&!this.active.is(".ui-state-disabled")){this.expand(k)}break;case c.ui.keyCode.ENTER:case c.ui.keyCode.SPACE:this._activate(k);break;case c.ui.keyCode.ESCAPE:this.collapse(k);break;default:g=false;j=this.previousFilter||"";l=String.fromCharCode(k.keyCode);i=false;clearTimeout(this.filterTimer);if(l===j){i=true}else{l=j+l}h=this._filterMenuItems(l);h=i&&h.index(this.active.next())!==-1?this.active.nextAll(".ui-menu-item"):h;if(!h.length){l=String.fromCharCode(k.keyCode);h=this._filterMenuItems(l)}if(h.length){this.focus(k,h);this.previousFilter=l;this.filterTimer=this._delay(function(){delete this.previousFilter},1000)}else{delete this.previousFilter}}if(g){k.preventDefault()}},_activate:function(g){if(!this.active.is(".ui-state-disabled")){if(this.active.is("[aria-haspopup='true']")){this.expand(g)}else{this.select(g)}}},refresh:function(){var k,h,j=this,i=this.options.icons.submenu,g=this.element.find(this.options.menus);this.element.toggleClass("ui-menu-icons",!!this.element.find(".ui-icon").length);g.filter(":not(.ui-menu)").addClass("ui-menu ui-widget ui-widget-content ui-front").hide().attr({role:this.options.role,"aria-hidden":"true","aria-expanded":"false"}).each(function(){var n=c(this),m=n.parent(),l=c("<span>").addClass("ui-menu-icon ui-icon "+i).data("ui-menu-submenu-carat",true);m.attr("aria-haspopup","true").prepend(l);n.attr("aria-labelledby",m.attr("id"))});k=g.add(this.element);h=k.find(this.options.items);h.not(".ui-menu-item").each(function(){var l=c(this);if(j._isDivider(l)){l.addClass("ui-widget-content ui-menu-divider")}});h.not(".ui-menu-item, .ui-menu-divider").addClass("ui-menu-item").uniqueId().attr({tabIndex:-1,role:this._itemRole()});h.filter(".ui-state-disabled").attr("aria-disabled","true");if(this.active&&!c.contains(this.element[0],this.active[0])){this.blur()}},_itemRole:function(){return{menu:"menuitem",listbox:"option"}[this.options.role]},_setOption:function(g,h){if(g==="icons"){this.element.find(".ui-menu-icon").removeClass(this.options.icons.submenu).addClass(h.submenu)}if(g==="disabled"){this.element.toggleClass("ui-state-disabled",!!h).attr("aria-disabled",h)}this._super(g,h)},focus:function(h,g){var j,i;this.blur(h,h&&h.type==="focus");this._scrollIntoView(g);this.active=g.first();i=this.active.addClass("ui-state-focus").removeClass("ui-state-active");if(this.options.role){this.element.attr("aria-activedescendant",i.attr("id"))}this.active.parent().closest(".ui-menu-item").addClass("ui-state-active");if(h&&h.type==="keydown"){this._close()}else{this.timer=this._delay(function(){this._close()},this.delay)}j=g.children(".ui-menu");if(j.length&&h&&(/^mouse/.test(h.type))){this._startOpening(j)}this.activeMenu=g.parent();this._trigger("focus",h,{item:g})},_scrollIntoView:function(j){var m,i,k,g,h,l;if(this._hasScroll()){m=parseFloat(c.css(this.activeMenu[0],"borderTopWidth"))||0;i=parseFloat(c.css(this.activeMenu[0],"paddingTop"))||0;k=j.offset().top-this.activeMenu.offset().top-m-i;g=this.activeMenu.scrollTop();h=this.activeMenu.height();l=j.outerHeight();if(k<0){this.activeMenu.scrollTop(g+k)}else{if(k+l>h){this.activeMenu.scrollTop(g+k-h+l)}}}},blur:function(h,g){if(!g){clearTimeout(this.timer)}if(!this.active){return}this.active.removeClass("ui-state-focus");this.active=null;this._trigger("blur",h,{item:this.active})},_startOpening:function(g){clearTimeout(this.timer);if(g.attr("aria-hidden")!=="true"){return}this.timer=this._delay(function(){this._close();this._open(g)},this.delay)},_open:function(h){var g=c.extend({of:this.active},this.options.position);clearTimeout(this.timer);this.element.find(".ui-menu").not(h.parents(".ui-menu")).hide().attr("aria-hidden","true");h.show().removeAttr("aria-hidden").attr("aria-expanded","true").position(g)},collapseAll:function(h,g){clearTimeout(this.timer);this.timer=this._delay(function(){var i=g?this.element:c(h&&h.target).closest(this.element.find(".ui-menu"));if(!i.length){i=this.element}this._close(i);this.blur(h);this.activeMenu=i},this.delay)},_close:function(g){if(!g){g=this.active?this.active.parent():this.element}g.find(".ui-menu").hide().attr("aria-hidden","true").attr("aria-expanded","false").end().find(".ui-state-active").not(".ui-state-focus").removeClass("ui-state-active")},_closeOnDocumentClick:function(g){return !c(g.target).closest(".ui-menu").length},_isDivider:function(g){return !/[^\-\u2014\u2013\s]/.test(g.text())},collapse:function(h){var g=this.active&&this.active.parent().closest(".ui-menu-item",this.element);if(g&&g.length){this._close();this.focus(h,g)}},expand:function(h){var g=this.active&&this.active.children(".ui-menu ").find(this.options.items).first();if(g&&g.length){this._open(g.parent());this._delay(function(){this.focus(h,g)})}},next:function(g){this._move("next","first",g)},previous:function(g){this._move("prev","last",g)},isFirstItem:function(){return this.active&&!this.active.prevAll(".ui-menu-item").length},isLastItem:function(){return this.active&&!this.active.nextAll(".ui-menu-item").length},_move:function(j,h,i){var g;if(this.active){if(j==="first"||j==="last"){g=this.active[j==="first"?"prevAll":"nextAll"](".ui-menu-item").eq(-1)}else{g=this.active[j+"All"](".ui-menu-item").eq(0)}}if(!g||!g.length||!this.active){g=this.activeMenu.find(this.options.items)[h]()}this.focus(i,g)},nextPage:function(i){var h,j,g;if(!this.active){this.next(i);return}if(this.isLastItem()){return}if(this._hasScroll()){j=this.active.offset().top;g=this.element.height();this.active.nextAll(".ui-menu-item").each(function(){h=c(this);return h.offset().top-j-g<0});this.focus(i,h)}else{this.focus(i,this.activeMenu.find(this.options.items)[!this.active?"first":"last"]())}},previousPage:function(i){var h,j,g;if(!this.active){this.next(i);return}if(this.isFirstItem()){return}if(this._hasScroll()){j=this.active.offset().top;g=this.element.height();this.active.prevAll(".ui-menu-item").each(function(){h=c(this);return h.offset().top-j+g>0});this.focus(i,h)}else{this.focus(i,this.activeMenu.find(this.options.items).first())}},_hasScroll:function(){return this.element.outerHeight()<this.element.prop("scrollHeight")},select:function(g){this.active=this.active||c(g.target).closest(".ui-menu-item");var h={item:this.active};if(!this.active.has(".ui-menu").length){this.collapseAll(g,true)}this._trigger("select",g,h)},_filterMenuItems:function(i){var g=i.replace(/[\-\[\]{}()*+?.,\\\^$|#\s]/g,"\\$&"),h=new RegExp("^"+g,"i");return this.activeMenu.find(this.options.items).filter(".ui-menu-item").filter(function(){return h.test(c.trim(c(this).text()))})}});var d=c.widget("ui.selectmenu",{version:"1.11.2",defaultElement:"<select>",options:{appendTo:null,disabled:null,icons:{button:"ui-icon-triangle-1-s"},position:{my:"left top",at:"left bottom",collision:"none"},width:null,change:null,close:null,focus:null,open:null,select:null},_create:function(){var g=this.element.uniqueId().attr("id");this.ids={element:g,button:g+"-button",menu:g+"-menu"};this._drawButton();this._drawMenu();if(this.options.disabled){this.disable()}},_drawButton:function(){var h=this,g=this.element.attr("tabindex");this.label=c("label[for='"+this.ids.element+"']").attr("for",this.ids.button);this._on(this.label,{click:function(i){this.button.focus();i.preventDefault()}});this.element.hide();this.button=c("<span>",{"class":"ui-selectmenu-button ui-widget ui-state-default ui-corner-all",tabindex:g||this.options.disabled?-1:0,id:this.ids.button,role:"combobox","aria-expanded":"false","aria-autocomplete":"list","aria-owns":this.ids.menu,"aria-haspopup":"true"}).insertAfter(this.element);c("<span>",{"class":"ui-icon "+this.options.icons.button}).prependTo(this.button);this.buttonText=c("<span>",{"class":"ui-selectmenu-text"}).appendTo(this.button);this._setText(this.buttonText,this.element.find("option:selected").text());this._resizeButton();this._on(this.button,this._buttonEvents);this.button.one("focusin",function(){if(!h.menuItems){h._refreshMenu()}});this._hoverable(this.button);this._focusable(this.button)},_drawMenu:function(){var g=this;this.menu=c("<ul>",{"aria-hidden":"true","aria-labelledby":this.ids.button,id:this.ids.menu});this.menuWrap=c("<div>",{"class":"ui-selectmenu-menu ui-front"}).append(this.menu).appendTo(this._appendTo());this.menuInstance=this.menu.menu({role:"listbox",select:function(h,i){h.preventDefault();g._setSelection();g._select(i.item.data("ui-selectmenu-item"),h)},focus:function(i,j){var h=j.item.data("ui-selectmenu-item");if(g.focusIndex!=null&&h.index!==g.focusIndex){g._trigger("focus",i,{item:h});if(!g.isOpen){g._select(h,i)}}g.focusIndex=h.index;g.button.attr("aria-activedescendant",g.menuItems.eq(h.index).attr("id"))}}).menu("instance");this.menu.addClass("ui-corner-bottom").removeClass("ui-corner-all");this.menuInstance._off(this.menu,"mouseleave");this.menuInstance._closeOnDocumentClick=function(){return false};this.menuInstance._isDivider=function(){return false}},refresh:function(){this._refreshMenu();this._setText(this.buttonText,this._getSelectedItem().text());if(!this.options.width){this._resizeButton()}},_refreshMenu:function(){this.menu.empty();var h,g=this.element.find("option");if(!g.length){return}this._parseOptions(g);this._renderMenu(this.menu,this.items);this.menuInstance.refresh();this.menuItems=this.menu.find("li").not(".ui-selectmenu-optgroup");h=this._getSelectedItem();this.menuInstance.focus(null,h);this._setAria(h.data("ui-selectmenu-item"));this._setOption("disabled",this.element.prop("disabled"))},open:function(g){if(this.options.disabled){return}if(!this.menuItems){this._refreshMenu()}else{this.menu.find(".ui-state-focus").removeClass("ui-state-focus");this.menuInstance.focus(null,this._getSelectedItem())}this.isOpen=true;this._toggleAttr();this._resizeMenu();this._position();this._on(this.document,this._documentClick);this._trigger("open",g)},_position:function(){this.menuWrap.position(c.extend({of:this.button},this.options.position))},close:function(g){if(!this.isOpen){return}this.isOpen=false;this._toggleAttr();this.range=null;this._off(this.document);this._trigger("close",g)},widget:function(){return this.button},menuWidget:function(){return this.menu},_renderMenu:function(i,h){var j=this,g="";c.each(h,function(k,l){if(l.optgroup!==g){c("<li>",{"class":"ui-selectmenu-optgroup ui-menu-divider"+(l.element.parent("optgroup").prop("disabled")?" ui-state-disabled":""),text:l.optgroup}).appendTo(i);g=l.optgroup}j._renderItemData(i,l)})},_renderItemData:function(g,h){return this._renderItem(g,h).data("ui-selectmenu-item",h)},_renderItem:function(h,i){var g=c("<li>");if(i.disabled){g.addClass("ui-state-disabled")}this._setText(g,i.label);return g.appendTo(h)},_setText:function(g,h){if(h){g.text(h)}else{g.html("&#160;")}},_move:function(k,j){var i,h,g=".ui-menu-item";if(this.isOpen){i=this.menuItems.eq(this.focusIndex)}else{i=this.menuItems.eq(this.element[0].selectedIndex);g+=":not(.ui-state-disabled)"}if(k==="first"||k==="last"){h=i[k==="first"?"prevAll":"nextAll"](g).eq(-1)}else{h=i[k+"All"](g).eq(0)}if(h.length){this.menuInstance.focus(j,h)}},_getSelectedItem:function(){return this.menuItems.eq(this.element[0].selectedIndex)},_toggle:function(g){this[this.isOpen?"close":"open"](g)},_setSelection:function(){var g;if(!this.range){return}if(window.getSelection){g=window.getSelection();g.removeAllRanges();g.addRange(this.range)}else{this.range.select()}this.button.focus()},_documentClick:{mousedown:function(g){if(!this.isOpen){return}if(!c(g.target).closest(".ui-selectmenu-menu, #"+this.ids.button).length){this.close(g)}}},_buttonEvents:{mousedown:function(){var g;if(window.getSelection){g=window.getSelection();if(g.rangeCount){this.range=g.getRangeAt(0)}}else{this.range=document.selection.createRange()}},click:function(g){this._setSelection();this._toggle(g)},keydown:function(h){var g=true;switch(h.keyCode){case c.ui.keyCode.TAB:case c.ui.keyCode.ESCAPE:this.close(h);g=false;break;case c.ui.keyCode.ENTER:if(this.isOpen){this._selectFocusedItem(h)}break;case c.ui.keyCode.UP:if(h.altKey){this._toggle(h)}else{this._move("prev",h)}break;case c.ui.keyCode.DOWN:if(h.altKey){this._toggle(h)}else{this._move("next",h)}break;case c.ui.keyCode.SPACE:if(this.isOpen){this._selectFocusedItem(h)}else{this._toggle(h)}break;case c.ui.keyCode.LEFT:this._move("prev",h);break;case c.ui.keyCode.RIGHT:this._move("next",h);break;case c.ui.keyCode.HOME:case c.ui.keyCode.PAGE_UP:this._move("first",h);break;case c.ui.keyCode.END:case c.ui.keyCode.PAGE_DOWN:this._move("last",h);break;default:this.menu.trigger(h);g=false}if(g){h.preventDefault()}}},_selectFocusedItem:function(h){var g=this.menuItems.eq(this.focusIndex);if(!g.hasClass("ui-state-disabled")){this._select(g.data("ui-selectmenu-item"),h)}},_select:function(h,g){var i=this.element[0].selectedIndex;this.element[0].selectedIndex=h.index;this._setText(this.buttonText,h.label);this._setAria(h);this._trigger("select",g,{item:h});if(h.index!==i){this._trigger("change",g,{item:h})}this.close(g)},_setAria:function(g){var h=this.menuItems.eq(g.index).attr("id");this.button.attr({"aria-labelledby":h,"aria-activedescendant":h});this.menu.attr("aria-activedescendant",h)},_setOption:function(g,h){if(g==="icons"){this.button.find("span.ui-icon").removeClass(this.options.icons.button).addClass(h.button)}this._super(g,h);if(g==="appendTo"){this.menuWrap.appendTo(this._appendTo())}if(g==="disabled"){this.menuInstance.option("disabled",h);this.button.toggleClass("ui-state-disabled",h).attr("aria-disabled",h);this.element.prop("disabled",h);if(h){this.button.attr("tabindex",-1);this.close()}else{this.button.attr("tabindex",0)}}if(g==="width"){this._resizeButton()}},_appendTo:function(){var g=this.options.appendTo;if(g){g=g.jquery||g.nodeType?c(g):this.document.find(g).eq(0)}if(!g||!g[0]){g=this.element.closest(".ui-front")}if(!g.length){g=this.document[0].body}return g},_toggleAttr:function(){this.button.toggleClass("ui-corner-top",this.isOpen).toggleClass("ui-corner-all",!this.isOpen).attr("aria-expanded",this.isOpen);this.menuWrap.toggleClass("ui-selectmenu-open",this.isOpen);this.menu.attr("aria-hidden",!this.isOpen)},_resizeButton:function(){var g=this.options.width;if(!g){g=this.element.show().outerWidth();this.element.hide()}this.button.outerWidth(g)},_resizeMenu:function(){this.menu.outerWidth(Math.max(this.button.outerWidth(),this.menu.width("").outerWidth()+1))},_getCreateOptions:function(){return{disabled:this.element.prop("disabled")}},_parseOptions:function(g){var h=[];g.each(function(j,l){var k=c(l),i=k.parent("optgroup");h.push({element:k,index:j,value:k.attr("value"),label:k.text(),optgroup:i.attr("label")||"",disabled:i.prop("disabled")||k.prop("disabled")})});this.items=h},_destroy:function(){this.menuWrap.remove();this.button.remove();this.element.show();this.element.removeUniqueId();this.label.attr("for",this.ids.element)}})}));